package org.simp.codec;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

public class SimpMessageCodecFactory implements ProtocolCodecFactory{
	
	private ProtocolEncoder encoder = new SimpResponseEncoder();
	
	private ProtocolDecoder decoder = new SimpRequestDecoder();

	public SimpMessageCodecFactory(){}
	
	public SimpMessageCodecFactory(ProtocolEncoder encoder,ProtocolDecoder decoder){
		this.encoder = encoder;
		this.decoder = decoder;
		
	}
	@Override
	public ProtocolDecoder getDecoder(IoSession arg0) throws Exception {
		return decoder;
	}

	@Override
	public ProtocolEncoder getEncoder(IoSession arg0) throws Exception {
		return encoder;
	}

}
